/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package chatroom.com.entity;

import java.io.Serializable;

/**
 *
 * @author Administrator
 */
public class UserModel implements Serializable {

    /**
     *
     */
    private static final long serialVersionUID = 1L;
    private int id;
    private String userName;//1
    private String userPass;//2
    private String nick;// 昵称3  //依次减一
    private String sex;//4
    private int age;//5
    private String email;//6
    private String qq;//7
    private String city;//8
    private int userState;//9  状态，1表示在线，2表示隐身，3表示忙碌
    private int guanliyuan;//10 为1表示为管理员，0表示不是管理员
    private int roomUserCount;

    public static UserModel getUserByString(String str) {
        UserModel user = new UserModel();
        String rs[] = str.split("&");                                    //分割
        user.setUserName(rs[1]);
        user.setUserPass(rs[2]);
        user.setNick(rs[3]);
        user.setSex(rs[4]);
        user.setAge(Integer.parseInt(rs[5]));
        user.setEmail(rs[6]);
        user.setQq(rs[7]);
        user.setCity(rs[8]);
        user.setUserState(Integer.parseInt(rs[9]));
        user.setGuanliyuan(Integer.parseInt(rs[10]));
        return user;
    }

    public static String[] getStringArrayByUserString(String str) {
        String rs[] = str.split("&");
        return rs;
    }

    public static String userToString(UserModel user) {
        return user.getUserName() + "&" + user.getUserPass() + "&"
                + user.getNick() + "&" + user.getSex() + "&" + user.getAge()
                + "&" + user.getEmail() + "&" + user.getQq() + "&"
                + user.getCity() + "&" + user.getUserState() + "&" + user.getGuanliyuan();

    }

    @Override
    public String toString() {
        return "UserModel [age=" + age + ", city=" + city + ", email=" + email
                + ", id=" + id + ", nick=" + nick + ", sex=" + sex
                + ", userName=" + userName + ", userPass=" + userPass + "]";
    }

    public int getId() {
        return id;
    }

    public void setId(int id) {
        this.id = id;
    }

    public String getUserName() {
        return userName;
    }

    public void setUserName(String userName) {
        this.userName = userName;
    }

    public String getUserPass() {
        return userPass;
    }

    public void setUserPass(String userPass) {
        this.userPass = userPass;
    }

    public String getNick() {
        return nick;
    }

    public void setNick(String nick) {
        this.nick = nick;
    }

    public String getSex() {
        return sex;
    }

    public int getGuanliyuan() {
        return guanliyuan;
    }

    public void setGuanliyuan(int guanliyuan) {
        this.guanliyuan = guanliyuan;
    }

    public void setSex(String sex) {
        this.sex = sex;
    }

    public String getEmail() {
        return email;
    }

    public void setEmail(String email) {
        this.email = email;
    }

    public String getCity() {
        return city;
    }

    public void setCity(String city) {
        this.city = city;
    }

    public int getAge() {
        return age;
    }

    public void setAge(int age) {
        this.age = age;
    }

    public static long getSerialversionuid() {
        return serialVersionUID;
    }

    public String getQq() {
        return qq;
    }

    public void setQq(String qq) {
        this.qq = qq;
    }

    public int getRoomUserCount() {
        return roomUserCount;
    }

    public void setRoomUserCount(int roomUserCount) {
        this.roomUserCount = roomUserCount;
    }

    public int getUserState() {
        return userState;
    }

    public void setUserState(int userState) {
        this.userState = userState;
    }
}